package com.lzy.cloud.member.service.impl;

import com.lzy.cloud.member.dtos.MemberCouponDto;
import com.lzy.cloud.member.entity.MemberCoupon;
import com.lzy.cloud.member.mapper.MemberCouponMapperExt;
import com.lzy.cloud.member.service.MemberCouponService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by WIN7 on 2018/5/30.
 */
@Service
public class MemberCouponServiceImpl implements MemberCouponService {

    @Autowired
    MemberCouponMapperExt memberCouponMapperExt;

    @Override
    public List<MemberCouponDto> queryList(MemberCouponDto memberCouponDto) {
        return memberCouponMapperExt.selectList(memberCouponDto);
    }

    @Override
    public Long add(MemberCouponDto memberCouponDto) {
        MemberCoupon memberCoupon =DozerUtils.map(memberCouponDto,MemberCoupon.class);
        return memberCouponMapperExt.insertSelective(memberCoupon)>0?memberCoupon.getId():null;
    }
}
